<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%><%@include file="/web/base/header.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>注册</title>
</head>
<body>
	<fieldset class="layui-elem-field layui-field-title">
		<legend>注册</legend>
		<div class="layui-field-box">
			<form class="layui-form" action="">
				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-inline">
						<input type="text" name="username" lay-verify="required"
							placeholder="请输入用户名" autocomplete="off" class="layui-input">
					</div>
				</div>


				<div class="layui-form-item">
					<label class="layui-form-label">密码框</label>
					<div class="layui-input-inline">
						<input type="password" name="password" lay-verify="required"
							lay-verify="required" placeholder="请输入密码" autocomplete="off"
							class="layui-input">
					</div>
				</div>


				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="register">立即注册</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						
					</div>
				</div>
				
				<input name="action" type="hidden" value="register" />

			</form>
			<button id="returnlogin" class="layui-btn">返回登录</button>

		</div>
	</fieldset>

	<script type="text/javascript">
		$("#returnlogin").click(returnlogin);
		formon('submit(register)',base.app+'/Servlet', 'text',
				function fun(data) {
					console.log(data);
					if("1"==data){
						layer.msg("注册成功");
						location.href = base.app+"/web/login.jsp";
						console.log("1");
					}else{
						alert("用户名重复");
						location.href = base.app+"/web/register.jsp";
						console.log("2");
					}
					
		});

		function returnlogin() {
			location.href = base.app+"/web/login.jsp";
		}
	</script>
</body>
</html>